package com.junxian.demo02.service;

import com.junxian.demo02.dao.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

/**
 * @Author: SunJunxian
 * @Date: 2018/12/11
 * @Description: Mapper
 */

@Mapper
@Component
public interface UserMapper {
    /**
     * 通过名字查询用户
     * @param name
     * @return Result<User>
     */
    @Select("select * from USER where NAME = #{name}")
    User findByName(@Param("name") String name);

    /**
     * 插入用户
     * @param name
     * @param age
     * @return Result<int>
     */
    @Insert("INSERT INTO USER(NAME , AGE) VALUES(#{name} , #{age})")
    int insert(@Param("name") String name , @Param("age") Integer age);

}
